home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 123 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.1 KB  |  47 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: FW: Inherent C++ problem (for comp.std.c++)
  5. Date: 23 Jan 1996 16:07:43 GMT
  6. Organization: Sun Microsystems Inc., Mountain View, CA
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <9601230936.AA27500@lts.sel.alcatel.de>
  9. References: <01BAE8B0.C408A920@dino.int.com>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Content-Type: text
  12. In-Reply-To: Eugene Lazutkin's message of 22 Jan 1996 10:13:43 PST
  13. Content-Length: 1307
  14. Originator: clamage@taumet
  15.  
  16. In article <01BAE8B0.C408A920@dino.int.com> Eugene Lazutkin
  17. <eugene@int.com> writes:
  18.  
  19. |> > Well, a typical optimisation here would be to construct the temporary
  20. |> > inside op+ directly into the return value slot. The construction of 'c'
  21. |> > would likely pass the address of 'c' as the return value slot. Thus, with
  22. |> > suitable inlining, it becomes very efficient.
  23.  
  24. |> > And the current wording of the draft allows such optimisations --
  25. |> > effectively arbitrary copy constructor invocations can be eliminated if
  26. |> > either the copy or the original is never used again (as in this example).
  27.  
  28. |> This is exactly the kind of optimization that one would be expecting but it cannot
  29. |> possibly work, at least not with the non-inline copy constructors:
  30.  
  31. It can, because the standard says it can.  The standard explicitly
  32. gives the implementation the right *not* to call the copy constructor
  33. in certain well-defined cases.  This is one of them.  (Note that there
  34. still must be an accessible copy constructor.)
  35.  
  36. --
  37. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  38. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  39. Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
  40.                 -- A la recherche d'une activitΘ dans une region francophone
  41.  
  42.  
  43. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  44.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  45.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  46.  
  47.